package com.oig.sys.config;


import com.oig.sys.listener.JpaAuditListener;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;


@RequiredArgsConstructor
@EnableConfigurationProperties(JpaAuditProperties.class)
public class JpaAuditConfiguration {


    @Bean
    @ConditionalOnMissingBean(JpaAuditProperties.class)
    public JpaAuditProperties jpaAuditProperties() {
        return new JpaAuditProperties();
    }

    @Bean
    public JpaAuditListener jpaAuditLogListener(JpaAuditProperties jpaAuditProperties){
        return new JpaAuditListener(jpaAuditProperties);
    }



}
